<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class MY_Controller extends CI_Controller {

	/**
	 *	Bazni Kontroler za admin strane
	 */
	public function __construct()
	{
		parent::__construct();
		

        
        // Ako je postavio "remeber" u login formi ondaje upamcen na tom racunaru
        $this->load->helper('cookie');
        if( get_cookie('user_loged') )
        {
          $this->session->set_userdata('user_logged',get_cookie('user_loged'));
        //if( isset(get_cookie('user_id')) )
          $this->session->set_userdata('user_id',get_cookie('user_id'));
        //if( isset(get_cookie('username')) )
          $this->session->set_userdata('username',get_cookie('username'));
        //if( isset(get_cookie('name')) )
          $this->session->set_userdata('name',get_cookie('name'));
        } 		
        //Provera logovanja
		if( ! $this->session->userdata('user_logged')) //ako nije logovan
		{
			//Preusmeri ga na stranu za logovanje
			//$data['header'] = '';
			//$data['contents'] = 'login';
			//$this->load->view('template/main',$data);
            redirect(base_url());
		}      
        // Load languge helper
        $this->load->helper('language');
        // Set language
        //if( ! $this->session->userdata('lang') ) // UVEK ES (Spanski)
        {
          $this->session->set_userdata('lang','de');
        }
        // Load language file
        $this->lang->load($this->session->userdata('lang'));
        
        // Load library modules
        $this->load->library('modules');
	}
}

/* End of file MY_Controller.php */
/* Location: ./core/MY_Controller.php */